package com.user.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import com.user.entity.Student;
import com.user.entity.Teacher;

@Repository
public interface StudentRepository extends PagingAndSortingRepository<Student, Long>, JpaSpecificationExecutor<Student> {
	@Query(value="from Student s where s.num = ?1 and s.password = ?2 and s.revoked=false")
	public Student findLogin(String num,String password);
	@Query(value="from Student s where s.department.id=?1")
	public List<Student> findByDeptId(Long id);
	@Query(value="from Student s where s.num=?1")
	public Student findByNum(String num);
}
